/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package snmpapplication.utils;

import java.util.ArrayList;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import snmpapplication.Main;
import snmpapplication.log.Severity;

/**
 * Class used for defining constants used in other classes
 * @author APetcu
 */
public class Constante {

    // System properties
    // System Description
    public static final String sysDescr = ".1.3.6.1.2.1.1.1.0";
    // System ID
    public static final String objId = ".1.3.6.1.2.1.1.2.0";
    // System uptime
    public static final String sysUpTime = ".1.3.6.1.2.1.1.3.0";
    // System Contact
    public static final String sysContact = ".1.3.6.1.2.1.1.4.0";
    // System Name
    public static final String sysName = ".1.3.6.1.2.1.1.5.0";
    // System Location
    public static final String sysLocation = ".1.3.6.1.2.1.1.6.0";
    // System Services
    public static final String sysServices = ".1.3.6.1.2.1.1.7.0";
    // Number of interfaces
    public static final String sysNoInterfaces = ".1.3.6.1.2.1.2.1.0";
    // Interface properties
    // Interface Index
    public static final String OIDifIndex = "1.3.6.1.2.1.2.2.1.1.";
    // Interface Description
    public static final String OIDifDescr = "1.3.6.1.2.1.2.2.1.2.";
    // Interface Type
    public static final String OIDifType = "1.3.6.1.2.1.2.2.1.3.";
    // Interface Speed
    public static final String OIDifSpeed = "1.3.6.1.2.1.2.2.1.5.";
    // Interface MAC address
    public static final String OIDifPhysAddress = "1.3.6.1.2.1.2.2.1.6.";
    // Interface administrative status
    public static final String OIDifAdminStatus = "1.3.6.1.2.1.2.2.1.7.";
    // Interface operational status
    public static final String OIDifOperStatus = "1.3.6.1.2.1.2.2.1.8.";
    // List containing all system OIDs
    public static final ArrayList<String> COMMON_OIDS = new ArrayList<String>();
    // true if the list of all OIDs was initialized
    private static boolean completeInit = false;
    // reachability constants
    // no reachability
    public static final Integer NO_REACH = 0;
    // ping reacability
    public static final Integer PING_REACH = 1;
    // snmp reachability
    public static final Integer SNMP_REACH = 2;

    /**
     * Method used for initializing the list with system OIDs
     */
    public static void initializareOids() {

        // add system OIDs to the list
        COMMON_OIDS.add(sysDescr);

        COMMON_OIDS.add(objId);

        COMMON_OIDS.add(sysUpTime);

        COMMON_OIDS.add(sysContact);

        COMMON_OIDS.add(sysName);

        COMMON_OIDS.add(sysLocation);

        COMMON_OIDS.add(sysServices);

        COMMON_OIDS.add(sysNoInterfaces);

        completeInit = true;
        
        Main.log.log(new Severity(Severity.SEV_INFO), "Initialization of constants complete");

    }

    public static void setUI() {
        try {

            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

            Main.log.log(new Severity(Severity.SEV_INFO), "Look and feel set");

        } catch (UnsupportedLookAndFeelException ex) {
            Main.log.log(new Severity(Severity.SEV_HIG), "Exception on look and feel: " + ex.getMessage());
        } catch (ClassNotFoundException ex) {
            Main.log.log(new Severity(Severity.SEV_HIG), "Exception on look and feel: " + ex.getMessage());
        } catch (InstantiationException ex) {
            Main.log.log(new Severity(Severity.SEV_HIG), "Exception on look and feel: " + ex.getMessage());
        } catch (IllegalAccessException ex) {
            Main.log.log(new Severity(Severity.SEV_HIG), "Exception on look and feel: " + ex.getMessage());
        }

    }
}
